CREATE TABLE [dbo].[Rating]
(
[RatingId] [int] NOT NULL IDENTITY(1, 1),
[ProductId] [int] NULL,
[CommentId] [int] NULL,
[RatingValue] [int] NOT NULL,
[CreatedDate] [datetime] NOT NULL,
[LastModifiedDate] [datetime] NOT NULL,
[IsDeleted] [bit] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[Rating] ADD CONSTRAINT [PK_Rating] PRIMARY KEY CLUSTERED  ([RatingId]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[Rating] ADD CONSTRAINT [FK_Rating_Comment] FOREIGN KEY ([CommentId]) REFERENCES [dbo].[Comment] ([CommentId])
GO
ALTER TABLE [dbo].[Rating] ADD CONSTRAINT [FK_Rating_Product] FOREIGN KEY ([ProductId]) REFERENCES [dbo].[Product] ([ProductId])
GO
